<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <ui:composition template="templatecustomer.xhtml">

        <ui:define name="pagename">
            Infomation Desk
        </ui:define>
        <ui:define name="content">
            <script type="text/javascript">
                function checkFormHotel (form) {
                var TestVar = form.elements["searchHotel:txtPrice"];
                var tax_id = parseFloat(TestVar.value);
                if(isNaN(tax_id)){
                    alert ("You have input Number");
                    TestVar.value = 0;
                    return false;
                }
                return true;
            }
            </script>
            <script type="text/javascript">
                function checkFormHotel2 (form) {
                var TestVar = form.elements["searchHotel:txtPrice2"];
                var tax_id = parseFloat(TestVar.value);
                if(isNaN(tax_id)){
                    alert ("You have input Number");
                    TestVar.value = 0;
                    return false;
                }
                return true;
            }
            </script>
            <script type="text/javascript">
                function checkFormCar (form) {
                var TestVar = form.elements["searchCar:txtPriceCar"];
                var tax_id = parseFloat(TestVar.value);
                if(isNaN(tax_id)){
                    alert ("You have input Number");
                    TestVar.value = 0;
                    return false;
                }
                return true;
            }
            </script>
            <script type="text/javascript">
                function checkFormCar2 (form) {
                var TestVar = form.elements["searchCar:txtPriceCar2"];
                var tax_id = parseFloat(TestVar.value);
                if(isNaN(tax_id)){
                    alert ("You have input Number");
                    TestVar.value = 0;
                    return false;
                }
                return true;
            }
            </script>
            <script type="text/javascript">
                function checkFormTour (form) {
                var TestVar = form.elements["searchTour:txtPriceTour"];
                var tax_id = parseFloat(TestVar.value);
                if(isNaN(tax_id)){
                    alert ("You have input Number");
                    TestVar.value = 0;
                    return false;
                }
                return true;
            }
            </script>
            <script type="text/javascript">
                function checkFormTour2 (form) {
                var TestVar = form.elements["searchTour:txtPriceTour2"];
                var tax_id = parseFloat(TestVar.value);
                if(isNaN(tax_id)){
                    alert ("You have input Number");
                    TestVar.value = 0;
                    return false;
                }
                return true;
            }
            </script>
            <br></br>
            Help customer find Hotel , Car rental or package tour in site
            <p:tabView id="tabView" style="width: 500px;">
                <!--******************** Tab 1 **************************-->
                <p:tab id="tab1" title="Hotel">
                    <h:form id="searchHotel">
                        <h2>Search Hotel</h2>
                        <hr style="border:none;background-color:#dedede;color:#dedede;height:1px;" />
                        <table>
                            <tr>
                                <td width="90px">Keyword : </td>
                                <td>
                                    <p:inputText id="txtHotelName" value="#{customerSearchBean.searchHotelString}" style="width: 160px"></p:inputText>
                                </td>
                            </tr>
                            <tr>
                                <td width="90px">Place Name : </td>
                                <td>
                                    <p:inputText id="txtPlaceName" value="#{customerSearchBean.placeNameString}" style="width: 160px"></p:inputText>
                                </td>
                            </tr>
                            <tr>
                                <td>Greater than : </td>
                                <td><p:inputText id="txtPrice" value="#{customerSearchBean.priceFrom}" onblur="checkFormHotel(this.form);" ></p:inputText> $</td>
                            </tr>
                            <tr>
                                <td>Less than : </td>
                                <td><p:inputText id="txtPrice2" value="#{customerSearchBean.priceTo}" onblur="checkFormHotel2(this.form);"></p:inputText> $</td>
                            </tr>
                            <tr>
                                <td></td>
                                <td><h:commandButton style="background-image: url(images/search.png);width: 80px;height: 34px" action="#{customerSearchBean.searchHotelAction}"></h:commandButton></td>
                            </tr>
                        </table>
                    </h:form>
                </p:tab>

                <!--******************** Tab 2 **************************-->
                <p:tab id="tab2" title="Car">
                    <h:panelGrid>
                        <h2>Search Car</h2>
                        <hr style="border:none;background-color:#dedede;color:#dedede;height:1px;" />
                        <h:form id="searchCar">
                            <table>
                                <tr>
                                    <td>Car Name :</td>
                                    <td><p:inputText id="txtCarName" value="#{customerSearchBean.carName}"></p:inputText></td>
                                </tr>
                                <tr>
                                    <td>Price From: </td>
                                    <td><p:inputText value="#{customerSearchBean.priceFromCar}" id="txtPriceCar" onblur="checkFormCar(this.form);"></p:inputText> $</td>
                                </tr>
                                <tr>
                                    <td>Price From: </td>
                                    <td><p:inputText value="#{customerSearchBean.priceToCar}" id="txtPriceCar2" onblur="checkFormCar2(this.form);"></p:inputText> $</td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td><h:commandButton style="background-image: url(images/search.png);width: 80px;height: 34px" action="#{customerSearchBean.searchCarByNameAction}"></h:commandButton></td>
                                </tr>
                            </table>
                        </h:form>
                    </h:panelGrid>
                </p:tab>

                <!--******************** Tab 3 **************************-->
                <p:tab id="tab3" title="Package Tour">
                    <h:panelGrid>
                        <h2>Search Package Tour</h2>
                        <hr style="border:none;background-color:#dedede;color:#dedede;height:1px;" />
                        <h:form id="searchTour">
                            <table>
                                <tr>
                                    <td>Place Name :</td>
                                    <td><p:inputText id="txtTourName" value="#{customerSearchBean.tourName}"></p:inputText></td>
                                </tr>
                                <tr>
                                    <td>Price From : </td>
                                    <td><p:inputText value="#{customerSearchBean.priceFromTour}" id="txtPriceTour" onblur="checkFormTour(this.form);"></p:inputText> $</td>
                                </tr>
                                <tr>
                                    <td>Price From : </td>
                                    <td><p:inputText value="#{customerSearchBean.priceToTour}" id="txtPriceTour2" onblur="checkFormTour2(this.form);"></p:inputText> $</td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td><h:commandButton style="background-image: url(images/search.png);width: 80px;height: 34px" action="#{customerSearchBean.searchAdvanceTourAction}"></h:commandButton></td>
                                </tr>
                            </table>
                        </h:form>
                    </h:panelGrid>
                </p:tab>

                <!--******************** Tab 4 **************************-->
                <p:tab id="tab4" title="Flight">
                    <h:panelGrid>
                        <h2>Search Flight</h2>
                        <hr style="border:none;background-color:#dedede;color:#dedede;height:1px;" />
                        <h:form>
                            <table>
                                <tr>
                                    <td width="120px">Depart Local :</td>
                                    <td><p:inputText value="#{customerSearchBean.departLocal}"></p:inputText></td>
                                </tr>
                                <tr>
                                    <td>Arrival Local :</td>
                                    <td><p:inputText value="#{customerSearchBean.arrLocal}"></p:inputText></td>
                                </tr>
                                <tr>
                                    <td width="80px">From Date :</td>
                                    <td><p:calendar value="#{customerSearchBean.dateFrom}" ></p:calendar></td>
                                </tr>
                                <tr>
                                    <td>To Date :</td>
                                    <td><p:calendar value="#{customerSearchBean.dateTo}"></p:calendar></td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td><h:commandButton action="#{customerSearchBean.searchFlightAction}" style="background-image: url(images/search.png);width: 80px;height: 34px"></h:commandButton></td>
                                </tr>
                            </table>
                        </h:form>
                    </h:panelGrid>
                </p:tab>
            </p:tabView>

            <!-- AREA LIST RESULT -->
            <!--******************List Hotel **********************-->
            <c:if test="#{customerSearchBean.listHotel != null}">
                <ui:repeat value="#{customerSearchBean.listHotel}" var="hotel">
<!--                    <h2>Hotel Name : #{hotel.hotelName}</h2>
                    <h3>Price : #{hotel.price}$</h3>
                    <h3>Rate : #{hotel.rate}</h3>
                    <img src="#{hotel.images}" alt="images" width="150px" height="150px"/>
                    <br/>-->
                    <table>
                        <tr><h1>#{hotel.hotelName}</h1></tr>

                        <tr>
                            <td><img width="150" height="150" alt="" src="#{hotel.images}" style="float:left;margin-right:20px;" /></td>
                            <td style="text-align: inherit">
                                <h3>Price : #{hotel.price}$</h3>
                                <h3>Rate : #{hotel.rate}</h3>
                            </td>
                        </tr>
                    </table>
                </ui:repeat>
            </c:if>
            <!--******************List Flight **********************-->
            <c:if test="#{customerSearchBean.listFlight != null}">
                <ui:repeat value="#{customerSearchBean.listFlight}" var="flight">
                    <h2>Flight : #{flight.flightName}</h2>
                    <h3>Date From : #{flight.departTime}</h3>
                    <h3>Date To : #{flight.arrTime}</h3>
                    <br/>
                </ui:repeat>
            </c:if>
            <!--******************List Car **********************-->
            <c:if test="#{customerSearchBean.listCar != null}">
                <ui:repeat value="#{customerSearchBean.listCar}" var="car">
                    <table>
                        <tr><h1>#{car.carName}</h1></tr>

                        <tr>
                            <td><img width="150" height="150" alt="" src="./images/trip1.jpg" style="float:left;margin-right:20px;" /></td>
                            <td style="text-align: inherit">
                                #{car.description}
                                <br/>
                                <a href="#">Read more...</a>
                            </td>
                        </tr>
                    </table>
                </ui:repeat>
            </c:if>
            <!--******************List Tour **********************-->
            <c:if test="#{customerSearchBean.listPackageTour != null}">
                <ui:repeat value="#{customerSearchBean.listPackageTour}" var="packageTour">
                    <table>
                        <tr><h1>#{packageTour.packageTourName}</h1></tr>
                        <tr>
                            <td><img width="150" height="150" alt="" src="#{packageTour.images}" style="float:left;margin-right:20px;" /></td>
                            <td style="text-align: inherit">
                                #{packageTour.description}
                                <br/>
                                <a href="#">Read more...</a>
                            </td>
                        </tr>
                    </table>
                </ui:repeat>
            </c:if>
        </ui:define>
    </ui:composition>
</html>

